package com.humanmonth.util.effect {
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;

	/**
	 * 鼠标经过对像时的效果
	 * @author 林子龙
	 */
	public class PassbyEffectGrow {
		/**
		 *发光效果 
		 */
		private var glow : GlowFilter;

		public function PassbyEffectGrow() {
			this.glow = new GlowFilter();
			this.glow.color = 0x3399FF;
			this.glow.quality = 3;
			this.glow.strength=1;
			this.glow.blurX=16;
			this.glow.blurY=16;
		}

		/**
		 * 为对像应用效果 
		 */
		public function applyFilter(obj : DisplayObject) : void {
			obj.addEventListener(MouseEvent.MOUSE_OVER, addFilter);
			obj.addEventListener(MouseEvent.MOUSE_OUT, minus);
		}

		/**
		 * 为对像增加过滤器 
		 */
		private function addFilter(event : MouseEvent) : void {
			var obj : DisplayObject = DisplayObject(event.currentTarget);
			EffectUtil.addFilter(obj,this.glow);
		}

		/**
		 *为对像删除过滤器 
		 */
		private function minus(event : MouseEvent) : void {
			var obj : DisplayObject = DisplayObject(event.currentTarget);
			EffectUtil.minusFilter(obj,this.glow);
		}
	}
}